package com.nexus.core.sys.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.nexus.core.query.annotation.QueryCondition;
import com.nexus.core.query.annotation.QueryType;
import com.nexus.core.service.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 系统用户
 *
 * @Date 2025/7/28 15:08
 * @Author Administrator
 **/
@Data
@EqualsAndHashCode(callSuper = false)
public class SysUserDTO extends BaseDTO {


    /**
     * 登录名
     */
    @ExcelProperty("登录名")
    @QueryCondition(tableField = "login_name", type = QueryType.EQ)
    private String loginName;
    /**
     * 归属部门
     */
    @ExcelProperty("归属部门")
    @QueryCondition(tableField = "office.id", type = QueryType.EQ)
    private SysOfficeDTO office;
    /**
     * 职务
     */
    @ExcelProperty("职务")
    @QueryCondition(tableField = "post.id", type = QueryType.EQ)
    private SysPostDTO post;
    /**
     * 姓名
     */
    @ExcelProperty("姓名")
    @QueryCondition(tableField = "name", type = QueryType.EQ)
    private String name;
    /**
     * 密码
     */
    @JsonIgnore // 序列化（返回给前端）时忽略该字段
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) // 仅允许写入（接收参数）
    @ExcelProperty("密码")
    private String password;
    /**
     *
     */
    @ExcelProperty("性别")
    @QueryCondition(tableField = "sex", type = QueryType.EQ)
    private String sex;
    /**
     * 年龄
     */
    @ExcelProperty("年龄")
    @QueryCondition(tableField = "age", type = QueryType.EQ)
    private Integer age;
    /**
     * 邮箱
     */
    @ExcelProperty("邮箱")
    @QueryCondition(tableField = "email", type = QueryType.EQ)
    private String email;
    /**
     * 手机
     */
    @ExcelProperty("手机")
    @QueryCondition(tableField = "phone", type = QueryType.EQ)
    private String phone;

    /**
     * 用户头像
     */
    @ExcelProperty("用户头像")
    @QueryCondition(tableField = "photo", type = QueryType.EQ)
    private String photo;
    /**
     * 最后登陆IP
     */
    @ExcelProperty("最后登陆IP")
    @QueryCondition(tableField = "login_ip", type = QueryType.EQ)
    private String loginIp;
    /**
     * 最后登陆时间
     */
    @ExcelProperty("最后登陆时间")
    @QueryCondition(tableField = "login_date", type = QueryType.EQ)
    private LocalDateTime loginDate;
    /**
     * 是否可登录
     */
    @ExcelProperty("是否可登录")
    @QueryCondition(tableField = "login_flag", type = QueryType.EQ)
    private String loginFlag;
    /**
     * 二维码
     */
    @ExcelProperty("二维码")
    @QueryCondition(tableField = "qr_code", type = QueryType.EQ)
    private String qrCode;
    /**
     * 是否是管理员
     */
    @ExcelProperty("是否是管理员")
    @QueryCondition(tableField = "admin", type = QueryType.EQ)
    private Integer admin;

    /**
     * 用户类型
     */
    @ExcelProperty("用户类型")
    @QueryCondition(tableField = "user_type", type = QueryType.EQ)
    private String userType;
}